#include <xen/io/console.h>
+/* Copies all print output to the Xen emergency console apart
+ of standard dom0 handled console */
+#define USE_XEN_CONSOLE
+
/* Low level functions defined in xencons_ring.c */
extern int xencons_ring_init(void);
extern int xencons_ring_send(const char *data, unsigned len);
(void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
return;
} else {
- if(!console_initialised)
+#ifndef USE_XEN_CONSOLE
+ if(!console_initialised)
+#endif
(void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(buf), buf);
console_print(buf, strlen(buf));
{
va_list args;
va_start(args, fmt);
- print(1, fmt, args);
+ print(0, fmt, args);
va_end(args);
}
#define read_cr2() \
(HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].arch.cr2)
+static int handling_pg_fault = 0;
+
void do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
unsigned long addr = read_cr2();
+ /* If we are already handling a page fault, and got another one
+ that means we faulted in pagetable walk. Continuing here would cause
+ a recursive fault */
+ if(handling_pg_fault)
+ {
+ printk("Page fault in pagetable walk (access to invalid memory?).\n");
+ do_exit();
+ }
+ handling_pg_fault = 1;
+
#if defined(__x86_64__)
printk("Page fault at linear address %p, rip %p, code %lx\n",
addr, regs->rip, error_code);
printk("Page fault at linear address %p, eip %p, code %lx\n",
addr, regs->eip, error_code);
#endif
+
dump_regs(regs);
page_walk(addr);
do_exit();
+ /* We should never get here ... but still */
+ handling_pg_fault = 0;
}
void do_general_protection(struct pt_regs *regs, long error_code)